
	**This file compiles descriptive stats**	

			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
	




*-------------------------------------------------------------------------------
* Prep
*-------------------------------------------------------------------------------

use removalcounts, clear

*make state county tag
bysort state county: gen statecountytag = 1 if _n == 1

*check number of obs: 369388
tabstat countymonthlytotal, stat(sum)

*-------------------------------------------------------------------------------
* Tables
*-------------------------------------------------------------------------------

*make title case state and county vars
gen State = proper(state)
gen County = proper(county)
gen Statecounty = County + ", " + State

*make summary variables
foreach var of varlist threat1count threat0count ///
 violentcount countymonthlytotal{
 bysort statecounty: egen total`var'=sum(`var') 
 }

 gen anyconvictioncount = totalcountymonthlytotal - totalthreat0count 
 gen anyconviction = countymonthlytotal - threat0count 

*Fifteen Large Counties 
 latabstat totalcountymonthlytotal totalthreat1 totalthreat0count ///
 totalviolentcount policymonth if statecountytag == 1  & totalcountymonthlytotal > 4400, ///
 stat(sum) by(Statecounty) tf(tableS2.tex) replace

*More General Summary Stats
 latabstat countymonthlytotal threat1count threat0count violentcount , ///
 stat(mean median sd max N) f(%9.0f) tf(table1.tex) replace

 

*-------------------------------------------------------------------------------
* Trends Over Time
*-------------------------------------------------------------------------------


**policies over time
bysort policymonth: egen temp=sum(statecountytag) if policymonth < . 
bysort policymonth: egen monthlypolicies=mean(temp)
drop temp

bysort policymonth: gen policymonthtag = 1 if _n == 1


***
*Figure 1
***

twoway (bar monthlypolicies policymonth if policymonth > m(2010m11) & ///
policymonth < m(2016m10) & policymonthtag == 1, ///
fi(inten40) barw(.6) yscale(range (0 40)) yti("Number of Policies Per Month") ///
xti("Year") xlabel(624(12)678, noticks format(%tmCY)))
graph export "fig1.pdf", replace



**
*Figure S4
**

twoway (lpoly logcountymonthlytotal month if policymonth == m(2013m10) & month > m(2011m1) ///
& month < m(2016m11), yaxis(1) bwidth(1)) ///
(lpoly logcountymonthlytotal month if policymonth > m(2016m10) & month > m(2011m1) ///
& month < m(2016m11), yaxis(1) bwidth(1)), ///
xti("Year") yti("Average Logged Deportations Per Month", axis(1)) ///
xlabel(612(12)677, noticks format(%tmCY)) ///
xline(645, lpattern(dot)) xline(685, lpattern(dot)) ///
legend(order(1  "California" 2 "Nonsanctuary Jurisdictions")) ///
text(2.95 645 "CA Sanctuary Law", placement(e) size(small)) text(2.3 685 "Trump Takes Office", placement(e) size(small))
graph export "s4.pdf", replace





*-------------------------------------------------------------------------------
* Before-After Plot
*-------------------------------------------------------------------------------

gen centeredmonth = month-policymonth

drop if centeredmo == .

**binned means
bysort centeredm: egen centeredmean = mean(logcountymonthlytotal)

***
*Figure S3
***


twoway (lpolyci logcountymonthlytotal centeredmonth if centeredmonth < 0 & centeredmonth > -11, ciplot(rline)) ///
(lpolyci logcountymonthlytotal centeredmonth if centeredmonth > 0 & centeredmonth < 11, ciplot(rline)) ///
(scatter centeredmean centeredmonth if centeredmonth < 0 & centeredmonth > -11, mcolor(black) msize(vsmall) msymbol(circle) ) ///
(scatter centeredmean centeredmonth if centeredmonth > 0 & centeredmonth < 11, mcolor(black) msize(vsmall) msymbol(circle) ) , ///
xti("Month Relative to Sanctuary Policy") yti("County Average Log Deportations Per Month") legend(off)
graph export "s3.pdf", replace

